package tests;

import static org.junit.Assert.*;

import model.LectureService;
import model.Service;
import model.ServiceFactory;
import model.StudentService;
import model.impl.LectureServiceImpl;
import model.impl.StudentServiceImpl;

import org.junit.Test;

public class InstantiationTest {

	@Test
	public void test() throws ClassNotFoundException
	{
		LectureService s = ServiceFactory.getInstance().getService(LectureService.class);
		assertNotNull(s);
		assertTrue(s instanceof LectureServiceImpl);
		assertTrue(true);
	}
	
	@Test(expected=ClassNotFoundException.class)
	public void wrongInstantiation() throws ClassNotFoundException
	{
		class DummyService implements Service
		{}
		
		DummyService ds = ServiceFactory.getInstance().getService(DummyService.class);
	}
	
	@Test
	public void StudentServiceInstantiation() throws ClassNotFoundException
	{
		StudentService s = ServiceFactory.getInstance().getService(StudentService.class);
		assertNotNull(s);
		assertTrue(s instanceof StudentServiceImpl);
	}

}
